
var gun = new Image();
	gun.src = 'source/image/nyan.gif';
	var img = [new Image(),new Image(),new Image(),new Image(),new Image()]; // картинки
			img[0].src = 'source/image/up1.gif';
			img[1].src = 'source/image/up2.gif';
			img[2].src = 'source/image/up3.gif';
			img[3].src = 'source/image/up4.gif';
			img[4].src = 'source/image/up5.gif';
setTimeout(function() {
		
	//var img = new Image();  // Создание нового объекта ихображения
	//img.src = 'source/image/pirateHat.gif';
	var now = (new Date().getTime()) - start;
	var progress = now / duration; 
	OwnPlayer.updateCoord();
	OtherPlayer.updateCoord();
	
	//alert(progress);
	ctx.clearRect(0, 0, canvas.width, canvas.height);
	ctx.fillStyle = '#55FF55';
	ctx.fillRect(0,0, canvas.width, canvas.height);


	ctx.fill();
	
	//верхняя пушка
	ctx.beginPath();
	ctx.fillStyle = '#A020F0';
	ctx.arc(canvas.width/2 - 1, 0, 20, 0, Math.PI, false);
//	ctx.arc(canvas.width/2, canvas.height, 50, 0, Math.PI*2, true);
    ctx.fill();
	
	//нижняя пушка
	ctx.beginPath();
//	ctx.arc(canvas.width/2, 0, 50, 0, Math.PI, false);
    ctx.fillStyle = '#A020F0';
	ctx.arc(canvas.width/2 - 1, canvas.height, 20, 0, Math.PI, true);
    ctx.fill();
	
	//полиция
	ctx.beginPath();
	ctx.fillStyle = '#FFFF00';
	ctx.arc(policeX, policeY, 50, 0, Math.PI*2, false);
	//ctx.closePath();
	ctx.fill();
	
	ctx.beginPath();
	ctx.fillStyle = '#3333FF';
	//ctx.fillRect(OtherPlayer.getX(), OtherPlayer.getY(), gridX , gridY);
	ctx.drawImage(img[OtherPlayer.getIndex()], OtherPlayer.getX(), OtherPlayer.getY(), 56, 56);
	ctx.drawImage(img[OwnPlayer.getIndex()], OwnPlayer.getX(), OwnPlayer.getY(), 56, 56);
	
	//пушки
	

	var phi1 = Math.atan2(OwnPlayer.getY(), canvas.width/2 -OwnPlayer.getX());
	var phi2 = Math.atan2(OtherPlayer.getY(),canvas.width/2 - OtherPlayer.getX());
	ctx.drawImage(gun, canvas.width/2 - 20 - 51*Math.cos(phi1), 20*Math.sin(phi1), 50, 20);
	//ctx.rotate( 8 * Math.PI / 4);
	ctx.drawImage(gun, canvas.width/2 - 51*Math.cos(phi2), canvas.height - 20 - 20*Math.sin(phi2), 50, 20);
	
	/*	if (progress < 1)	
		ctx.fillRect(10, 10, progress*100, 100);
	if (progress < 2 && progress > 1)
		ctx.fillRect(10, 10, (2-progress)*100, 100);*/
	
	ctx.fillRect(OwnPlayer.getCubikX(),OwnPlayer.getCubikY(), 10 , 10);
	ctx.fillRect(OtherPlayer.getCubikX(),OtherPlayer.getCubikY(), 10 , 10);
	if (collision(OtherPlayer.getCubikX() + 5, OtherPlayer.getCubikY() + 5, OtherPlayer.getX() + 28, OtherPlayer.getY() + 28, 50))
		OtherPlayer.incGood();
	if (collision(OwnPlayer.getCubikX() + 5, OwnPlayer.getCubikY() + 5, OwnPlayer.getX() + 28, OwnPlayer.getY() + 28, 50))
		OwnPlayer.incGood();
		
	if (collision(canvas.width/2, canvas.height/2, OwnPlayer.getX() + 28, OwnPlayer.getY() + 28, 50)) alert("Вы арестованы!")
	else if (collision(canvas.width/2, canvas.height/2, OtherPlayer.getX() + 28, OtherPlayer.getY() + 28, 50)) alert("УРА! ПОБЕДА!")
	else setTimeout(arguments.callee, 10);
	
	
}, 10);
var m = 0;
setTimeout(function() {
	m++;
	document.getElementById('test-id').innerHTML = m;
	setTimeout(arguments.callee, 1000);
}, 1000);